<h1>Edit User</h1>
<p>Please enter the users information below.</p>
<?php if(!empty($message)) {?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<?php echo $message;?></div>
<?php }?>
<?php echo form_open(uri_string());?>
<table width="100%" class="table-condensed">  
        <tr>
          <td width="31%">First Name: </td>
          <td colspan="2"><?php echo form_input($first_name);?></td>
        </tr>
        <tr>
          <td>Last Name: </td>
          <td colspan="2"><?php echo form_input($last_name);?></td>
        </tr>
        <!--<tr>
          <td>Company Name: </td>
          <td colspan="2"><?php echo form_input($company);?></td>
        </tr>-->
        <tr>
          <td>Phone: </td>
          <td colspan="2"><?php echo form_input($phone1);?></td>
        </tr>
        <tr>
          <td>Email /Username</td>
          <td colspan="2"><?php echo form_input($email);?></td>
        </tr>
        <tr>
          <td>Password: (if changing password)<br /></td>
          <td colspan="2"><?php echo form_input($password);?></td>
        </tr>
        <tr>
          <td>Confirm Password: (if changing password)<br /></td>
          <td colspan="2"><?php echo form_input($password_confirm);?></td>
        </tr>
        <?php if($this->ion_auth->is_admin()) {?>
        <tr valign="top">
          <td><h5>Member of groups</h5>
            <?php foreach ($groups as $group):?>
            <label class="checkbox">
              <?php
		$gID=$group['id'];
		$checked = null;
		$item = null;
		foreach($currentGroups as $grp) {
			if ($gID == $grp->id) {
				$checked= ' checked="checked"';
			break;
			}
		}
	?>
              <input type="checkbox" name="groups[]" value="<?php echo $group['id'];?>"<?php echo $checked;?> />
            <?php echo $group['name'];?></label>
          <?php endforeach?></td>
          <td width="26%"><h5>User Type</h5>
            <?php foreach ($user_type as $users):?>
            <label class="checkbox">
              <?php
		$uID=$users['id'];
		$checked = null;
		$item = null;
		foreach($currentUser as $usr) {
			if ($uID == $usr->id) {
				$checked= ' checked="checked"';
			break;
			}
		}
	?>
              <input type="checkbox" name="user_types[]" value="<?php echo $users['id'];?>"<?php echo $checked;?> />
            <?php echo $users['name'];?></label>
          <?php endforeach?></td>
          <td width="43%"><h5>Department</h5>
            <?php foreach ($get_departments as $departments):?>
            <label class="checkbox">
              <?php
		$dID=$departments['id'];
		$checked = null;
		$item = null;
		foreach($currentDepartments as $dpt) {
			if ($dID == $dpt->id) {
				$checked= ' checked="checked"';
			break;
			}
		}
	?>
              <input type="checkbox" name="department[]" value="<?php echo $departments['id'];?>"<?php echo $checked;?> />
            <?php echo $departments['name'];?></label>
            <?php endforeach?>
            <?php echo form_hidden('id', $user->id);?> <?php echo form_hidden($csrf); ?>
          </td>
        </tr>
        <?php }?>
        <tr>
          <td colspan="3"><?php echo form_submit($submit);?></td>
  </tr>
</table>
<?php echo form_close();?>
